package cn.itcast.account.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@LocalTCC
public interface AccountTccService {

    @TwoPhaseBusinessAction(name = "tryTcc",commitMethod = "confirm",rollbackMethod = "cancel")
    public void tryTcc(@BusinessActionContextParameter(paramName = "userId") String userId,
                       @BusinessActionContextParameter(paramName = "money") Integer money);

    public boolean confirm(BusinessActionContext bac);


    public boolean cancel(BusinessActionContext bac);

}
